package com.example.wificon;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

public class GetTask extends Activity{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Spinner region;
		Spinner numberOfTasks;
		Button home;
		Button exit;
		Button settings;
		Button manageWiFi;
		Button takeTask;
		Button create;
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.get_task);

		//TODO : loads data from database
		List<String> numberOfTasksList =  new ArrayList<String>();
		numberOfTasksList.add("10 tasks");
	    numberOfTasksList.add("20 tasks");
	    numberOfTasksList.add("30 tasks");
	    numberOfTasksList.add("40 tasks");

	    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, numberOfTasksList);
	    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		
	    numberOfTasks = (Spinner) findViewById(R.id.number_of_tasks);
		numberOfTasks.setAdapter(adapter);

		
		List<String> regionList =  new ArrayList<String>();
		regionList.add("Mladost");
		regionList.add("Banishora");

		adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, regionList);
	   
		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 		region = (Spinner) findViewById(R.id.regions);
 		region.setAdapter(adapter);
		// End TODO!
 		home = (Button) findViewById(R.id.home_button_task);
		home.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});
		exit = (Button) findViewById(R.id.exit_button);
		exit.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				System.exit(0);
			}
		});
		settings = (Button) findViewById(R.id.settings_button);
		settings.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				ChangeScreen("ACCOUNT_SETTINGS");
			}
		});
		manageWiFi = (Button) findViewById(R.id.manage_wifi_button);
		manageWiFi.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				ChangeScreen("MANAGE_NETWORKS");
			}
		});
		
		create = (Button) findViewById(R.id.create_button);
		create.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				//check in data base information from the username and password
				ChangeScreen("TARGET_LIST");
			}
		});
	}
	
	private void ChangeScreen(String intentName){
		Intent changeScreen;
		changeScreen = new Intent("com.example.wificon." + intentName);
		startActivity(changeScreen);
	}
}
